feat: add exclude_annotation support to avoid_unused_parameters#312
Conversation
…to ignore generated classes
There was a problem hiding this comment.
Code Review
This pull request introduces the exclude_annotation parameter to the avoid_unused_parameters lint rule, allowing users to ignore constructor parameters for classes annotated with specific annotations (such as @freezed). It also skips redirecting constructors. The review feedback suggests improving the robustness of the configuration parsing by supporting both single strings and lists, handling prefixed annotations (e.g., @meta.freezed), expanding the check to other enclosing declarations using node.parent, and adding a corresponding unit test for prefixed annotations.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…tion to lists and add associated parsing tests
…s in avoid_unused_parameters lint
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the exclude_annotation parameter to the avoid_unused_parameters lint rule, allowing constructor parameters of classes annotated with specific annotations (such as @freezed) to be ignored. It also updates parameter parsing across several list parameters to support single string values in addition to lists. Feedback on this PR suggests simplifying the shouldIgnore method in ExcludedAnnotationsListParameter by checking current is Declaration directly, which would make the traversal more robust and future-proof.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the exclude_annotation parameter to the avoid_unused_parameters lint rule, allowing constructor parameters of classes annotated with specified annotations (such as @freezed) to be ignored. It also refactors several parameter parsers to support single-string configurations and adds comprehensive unit tests. The review feedback suggests improving the robustness of the YAML parsing logic by checking for Iterable instead of List in ExcludedEntitiesListParameter and ExcludedAnnotationsListParameter, and supporting single-map configurations in ExcludedIdentifiersListParameter by handling Map types.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Code Review
This pull request introduces the exclude_annotation parameter to the avoid_unused_parameters lint rule, allowing constructor parameters of classes with specific annotations (like @freezed) to be ignored. It also updates parameter parsing to support single string values alongside lists. The review feedback highlights a readability improvement regarding operator precedence in the visitor class, and identifies a flaw in the new tests where redirecting factory constructors are used, which are already ignored by another check, thus failing to properly isolate and test the exclude_annotation functionality.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…sing, and fix operator precedence in unused parameter visitor
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the exclude_annotation parameter for the avoid_unused_parameters lint rule, allowing users to ignore constructor parameters for classes annotated with specific annotations (e.g., @freezed). It adds the ExcludedAnnotationsListParameter class, updates parameter parsing logic across other excluded parameters to be more flexible (supporting single strings and iterables), and updates the AST visitor to skip redirected constructors and classes with excluded annotations. Comprehensive tests are also added. The reviewer suggested improving the annotation matching logic to check both the full name (including prefixes) and the simple name of the annotation.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Closes #147